home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Today - The Disc! 5
/
CD-ROM Today - The Disc (Issue 5)(November 1994).ISO
/
mac
/
Mac shareware
/
Education
/
RLaB
/
help
/
rand
< prev
next >
Wrap
Text File
|
1994-09-21
|
3KB
|
120 lines
rand:
Syntax: rand ( )
rand ( nrow , ncol )
rand ( "type" )
rand ( "type" , d1 )
rand ( "type" , d1 , d2 )
Description:
rand() creates a random scalar, or matrix.
`rand()' produces a random scalar.
`rand ( X , Y )' produces a randomly generated MATRIX with row
dimension X, and column dimension Y.
`rand ( "type" , ... )' changes the distribution used when
generating random numbers. The value of type determines the
subsequent parameters.
type:
rand( "beta" , A , B )
Returns a single random deviate from the beta distribution
with parameters A and B. The density of the beta is
x^(a-1) * (1-x)^(b-1) / B(a,b) for 0 < x < 1
rand ( "chi" , DF )
Generates random deviate from the distribution of a chi-square
with DF degrees of freedom random variable.
rand ( "exp" , AV )
Generates a single random deviate from an exponential
distribution with mean AV.
rand ( "f" , DFN DFD )
Generates a random deviate from the F (variance ratio)
distribution with DFN degrees of freedom in the numerator and
DFD degrees of freedom in the denominator.
rand ( "gamma" , A , R )
Generates random deviates from the gamma distribution whose
density is
(A**R)/Gamma(R) * X**(R-1) * Exp(-A*X)
rand ( "nchi" , DF , XNONC )
Generates random deviate from the distribution of a noncentral
chi-square with DF degrees of freedom and noncentrality
parameter XNONC.
rand ( "nf" , DFN , DFD, XNONC )
Generates a random deviate from the noncentral F (variance
ratio) distribution with DFN degrees of freedom in the
numerator, and DFD degrees of freedom in the denominator, and
noncentrality parameter XNONC.
rand ( "normal" , AV , SD )
Generates a single random deviate from a normal distribution
with mean, AV, and standard deviation, SD.
rand ( "uniform" , LOW , HIGH )
Generate Uniform double between LOW and HIGH
rand ( "bin" , N , P )
Returns a single random deviate from a binomial distribution
whose number of trials is N and whose probability of an event
in each trial is P.
rand ( "poisson" , AV )
Generates a single random deviate from a Poisson distribution
with mean AV.
rand ( "default" )
Resets the random number generator to the default generator,
which generates a distributed random variable in the interval
0 -> 1. The interval endpoints are not returned.
Examples:
> rand()
0.368
> rand(4)
vector elements 1 thru 4
0.983 0.535 0.766 0.646
> rand(3,3)
matrix columns 1 thru 3
0.767 0.152 0.347
0.78 0.625 0.917
0.823 0.315 0.52
> rand("norm", 10.0, 2.0 );
> rand(10)
vector elements 1 thru 5
9.86 11.8 12.1 7.35 8.76
vector elements 6 thru 10
10.5 7.44 11.1 6.93 9.87
rand() uses the RANLIB library, authored by B. W. Brown and
J. Lovato under grant CA-16672 from the National Cancer
Institute.
See Also: srand